document.addEventListener('DOMContentLoaded', function() {
    // 导航栏用户下拉菜单功能
    const userDropdown = document.querySelector('.user-dropdown');
    if (userDropdown) {
        userDropdown.addEventListener('click', function(e) {
            const dropdownContent = this.querySelector('.dropdown-content');
            dropdownContent.style.display =
                dropdownContent.style.display === 'block' ? 'none' : 'block';
        });

        // 点击页面其他地方关闭下拉菜单
        document.addEventListener('click', function(e) {
            if (!userDropdown.contains(e.target)) {
                const dropdownContent = userDropdown.querySelector('.dropdown-content');
                dropdownContent.style.display = 'none';
            }
        });
    }
});